﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


class KElementsWithMaximalSum
{
    static void Main()
    {
        Console.WriteLine("Enter the length of the array N:");
        int n = int.Parse(Console.ReadLine());
        Console.WriteLine("Enter the K < N:");
        int k = int.Parse(Console.ReadLine());
        Console.WriteLine("Enter the elements of the array:");
        int[] arr = new int[n];
        for (int i = 0; i < arr.Length; i++)
        {
            arr[i] = int.Parse(Console.ReadLine());
        }
        Console.WriteLine();
        Array.Sort(arr);
        Array.Reverse(arr);
        for (int i = 0; i < k; i++)
        {
            Console.WriteLine(arr[i]);
        }

    }
}

